<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>controller</title>

    <script src="https://cdn.bootcss.com/angular.js/1.6.4/angular.min.js"></script>
</head>
<body>
    <div ng-app="myApp" ng-controller="myController">
        <div>{{name}}</div>
        <input type="text" ng-model="name">
        <div ng-click="sayHello()">点我</div>
    </div>

</body>
<script>
    
    var app = angular.module('myApp',[]);
    //参数1：控制器名字：参数2：回调函数
    app.controller('myController',function ($scope,$location) {
        $scope.name='李申';
        $scope.sayHello=function () {
            alert($scope.name);
        }
        console.log($location);
    });
</script>
</html>